<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>考神驾到手机站资讯页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/public.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/windowsheight.js"></script>


    <script src="${pageContext.request.contextPath}/manager_page/layui/layui.js"></script>

<%--    <style type="text/css">--%>
<%--        .fix_bottom{--%>
<%--            position: fixed;left: 0;bottom: 0;--%>
<%--        }--%>
<%--    </style>--%>
</head>

<body>
<!-----------头部开始--------------->
<%@ include file="page_head.jsp"%>
<!-----------头部结束--------------->
<!-----------内容开始--------------->
 <div class="content">

     <div class="biaoshitop">&nbsp;</div>
     <div class="titlecom">
         <p class="video_p"><a href="javascript:;">新闻</a></p>
         <div class="tabtila fr">
             <a href="javascript:changeNews('使用技巧');">使用技巧</a> | <a href="javascript:changeNews('系统通知');">系统通知</a>
             <a  href="javascript:;" class="titlemore"><img src="images/title_69.jpg"/></a>
         </div>
         <div class="moresort" id="moresort_div_parent">
             <div class="moresost_con" id="moresort_div">
                 <span><a href="javascript:changeNews('');">全部</a></span>
                 <span><a href="javascript:changeNews('使用技巧');">使用技巧</a></span>
                 <span><a href="javascript:changeNews('系统通知');">系统通知</a></span>
                 <span><a href="javascript:changeNews('注意事项');">注意事项</a></span>
                 <div class="clear"></div>
             </div>
         </div>
     </div>

     <div class="contentnew">
         <ul class="contentnew_con" id="news_ul">

<%--                          <li>--%>
<%--                              <a href="test_kemu4.jsp" class="newsimg" ><img src="images/yijiakoa_24.jpg"></a>--%>
<%--                              <div class="newrigcon">--%>
<%--                                  <h1><a href="test_kemu4.jsp">贵阳平安驾贵阳平安驾校科目四试题模拟练习校科目四试题模拟练习</a></h1>--%>
<%--                                  <p>贵阳平安驾校科目四贵阳平安驾校科目四试题模拟练习试题模拟练习...  </p>--%>
<%--                              </div>--%>
<%--                              <div class="clear"></div>--%>
<%--                          </li>--%>

         </ul>
         <div class="noborder">&nbsp;</div>
     </div>

     <div class="pageturn">
         <div class="prepage"><a href="javascript:lastPage();">< 上一页</a></div>
         <p><span><b id="current_page">1</b>/<label id="total_page">0</label></span></p>
         <div class="prepage"> <a href="javascript:nextPage();">下一页 ></a></div>
     </div>

 </div>
 <!-----------内容结束--------------->
<%-- <div class="footer fix_bottom">--%>
<%--   <p>©考神驾到版权所有</p>--%>
<%--   <span>www.kaoshenjiadao.com</span>--%>
<%-- </div>--%>
 
</body>


<script>
    var layer;
    layui.use('layer',function (){
        layer=layui.layer;
    })

    $("#page_head_title").text("新闻");

    var array_news;
    var flag_title=true;
    var total_page;
    var current_page=1;

    window.onload=function(){
        changeNews('');
    }

    function changeNews(news_class){
        $.ajax({
            url:"${pageContext.request.contextPath}/front_news/news_relative.do",
            data:{
                "news_class":news_class,
                "news_id":-1
            },
            success:function(data,status){
                if(status=="success"){
                    total_page=Math.ceil(data.length/5);
                    current_page=1;
                    array_news=data;
                    changeUl(data,1);
                    $("#current_page").text(current_page);
                    $("#total_page").text(total_page);

                }
            }
        })

        $("#moresort_div_parent").attr("style","display: none;");
        $(".titlemore img").attr("src","images/title_69.jpg");
        flag_title=true;
    }

    function changeUl(data,page){

        var index_start=(page-1)*5;
        var index_end=index_start+5;
        if(page==total_page){
            index_end=data.length;
        }
        if(total_page==0){
            index_end=0;
        }


        $("#news_ul").empty();
        var path="${pageContext.request.contextPath}/img_artificial/news_img/";
        for(var i=index_start;i<index_end;i++){
            var li=$("<li></li>");
            var a1=$("<a></a>").attr({
                "href":"javascript:to_newsdetail("+data[i].news_id+");",
                "class":"newsimg"
            });
            var img=$("<img>").attr("src",path+data[i].news_img);
            a1.append(img);
            var div=$("<div></div>").attr("class","newrigcon");
            var h1=$("<h1></h1>");
            var a2=$("<a></a>").attr("href","javascript:to_newsdetail("+data[i].news_id+");").text(data[i].news_title);
            h1.append(a2);
            var p=$("<p></p>").text(data[i].news_content);
            div.append(h1,p);
            var div_end=$("<div></div>").attr("class","clear");
            var a3=$("<a></a>").attr("href","javascript:to_newsdetail("+data[i].news_id+");");
            a3.append(a1,div,div_end);
            li.append(a3);
            $("#news_ul").append(li);
        }
    }

    function to_newsdetail(news_id){
        window.location.href="news_detail.jsp?news_id_hidden="+news_id;
    }

    function lastPage(){
        if(current_page<=1){
            layer.msg("这已经是第一页了");
        }else{
            current_page--;
            changeUl(array_news,current_page);
            $("#current_page").text(current_page);
        }
    }

    function nextPage(){
        if(current_page>=total_page){
            layer.msg("这已经是最后一页了");
        }else{
            current_page++;
            changeUl(array_news,current_page);
            $("#current_page").text(current_page);
        }
    }






    $(".titlemore").click(function (){
        if(flag_title){
            $("#moresort_div_parent").attr("style","display: block;");
            $(".titlemore img").attr("src","images/title_692.jpg");
            flag_title=false;
        }else{
            $("#moresort_div_parent").attr("style","display: none;");
            $(".titlemore img").attr("src","images/title_69.jpg");
            flag_title=true;
        }

    })

</script>









<!--头部高度赋给列表的topjs-->
<script>
   var heighttop=$(".top").height();
   $(".topmenu").css("top",heighttop);
    $(".menumore").toggle(function(){
	     $(".topmenu").show(); 
	   },function(){
	     $(".topmenu").hide(); 
	 	   })
   $(".buttontop").click(function(){
	     $(".topmenu").hide();  
	   })
	   
 $(function(){
	 $(".tasecartop span a").click(function(){
		  var $banktip=$(this).attr("tip");
		  $($banktip).show().siblings().hide();
		  $(".tasecartop span a").removeClass("payaclik");
		  $(this).addClass("payaclik");
		 })
	
	})
 </script>
 
<!--头部高度赋给列表的topjs-->
<!--banner将图片的高度赋给父级扪js-->
<script>
   var heighta=$("#incltialiu li:eq(0) img").height();
   $(".main,.width,#incltialiu").height(heighta) ;
 </script>
 <!--banner将图片的高度赋给父级扪js-->
<!--首页标题点击出现更多分类js-->
<%-- <script>--%>
<%--	$(".titlemore").toggle(function(){--%>
<%--		$(this).parent(".tabtila").siblings(".moresort").show()--%>
<%--		$(this).children("img").attr("src","images/title_692.jpg")--%>
<%--		},function(){--%>
<%--		$(this).parent(".tabtila").siblings(".moresort").hide()--%>
<%--		$(this).children("img").attr("src","images/title_69.jpg")--%>
<%--		})--%>
<%--  </script>--%>
 <!--首页标题点击出现更多分类js-->
</html>
